package com.gaokuo.es.compose;

/**
 * 组节点,有子节点
 * @author gaokuo
 */
public class ComposeNestedNode extends AbComposeNode{

    /**
     * 子节点
     */
    private AbComposeNode childNode;

    public ComposeNestedNode(ComposeBindEnum bind) {
        super(bind);
    }
    public ComposeNestedNode() {
        super(null);
    }

    /**
     * 添加node到子节点末尾
     * @param node ~
     * @return this
     */
    public ComposeNestedNode addChildNode(AbComposeNode node){
        //子根节点
        if(childNode == null){
            childNode = node;
            return this;
        }
        //非根节点
        addNodeTo(node,childNode);
        return this;
    }

    public AbComposeNode childNode(){
        return childNode;
    }
}
